$(document).ready(function(){
	var Id=$('#Id').val();
	var flag=$('#flag').val();
	//事件绑定
	eventBind(flag,Id);
});
//事件绑定
function eventBind(flag,Id){
	$('#cancel').click(function(){
		BootstrapDialog.closeAll();
	})
	$('#save').on('click',function(){
		saveRemark(flag,Id);
	});
}
//转诊操作
function saveRemark(flag,Id){
	if(!$("#remarkForm").validationForm()){
		return;
	}
	if(flag=='agree'){//通过
		$.getApiClient('/study/agree/{id}').setQuery({id:Id}).put('#remarkForm').done(function(data){
			if(data.code == "0"){
				BootstrapDialog.closeAll();
				customTimeOutDialog('信息提示','审核完成',null,2000);
				pageQuery();
			}else{
				customAlertDialog(data.message, '错误提示', null, null);
			}
		});
	}else if(flag=='unagree'){//不通过
		$.getApiClient('/study/uagree/{id}').setQuery({id:Id}).put('#remarkForm').done(function(data){
			if(data.code == "0"){
				BootstrapDialog.closeAll();
				customTimeOutDialog('信息提示','审核完成',null,2000);
				pageQuery();
			}else{
				customAlertDialog(data.message, '错误提示', null, null);
			}
		});
	}
}

